<!DOCTYPE html>
<html ng-app="peiwan_admin">
<head>
<meta charset="UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>推广人列表</title>
<script type="text/javascript" src="js/settings.min.js"></script>
<script type="text/javascript"
	src="http://cdn.bootcss.com/basket.js/0.5.2/basket.full.min.js"></script>
<link rel="stylesheet"
	href="http://cdn.bootcss.com/pure/0.6.0/pure-min.css">
<link rel="stylesheet" href="css/adapt.min.css">
<link rel="stylesheet" href="css/lw_desk.css">
<link rel="stylesheet"
	href="http://cdn.bootcss.com/alertify.js/0.3.11/alertify.core.min.css">
<link rel="stylesheet"
	href="http://cdn.bootcss.com/alertify.js/0.3.11/alertify.default.css">
</head>
<body ng-controller="PromoterListCtrl">
	<div class="pure-u-1 padding3">
		<button ng-click="createPromoter()" class="pure-button blue">新建推广人</button>
		<table class="horizontal-center pure-table pure-table-bordered">
			<thead>
				<tr>
					<th>#</th>
					<th>用户账号</th>
					<th>支付宝账号</th>
					<th>姓名</th>
					<th>抽成比例</th>
					<th>代理区域</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="p in promoters">
					<td>{{p.id}}</td>
					<td>{{p.username}}</td>
					<td>{{p.alipayUsername}}</td>
					<td>{{p.name}}</td>
					<td>{{p.rate}}</td>
					<td ng-click="showDistricts(p.id,p.name)"><span
						ng-repeat='d in p.districtRelations'>{{d.city}}{{d.district}};</span></td>
					<td>
						<button ng-click="deletePromoter(p.id)"
							class="pure-button horizontal-center red">删除</button>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<div class="pure-u-1 padding3">
		<a href="javascript:" ng-click="prePage()">前一页</a> <input
			id="page_input" placeholder="跳转到" value="1" />
		<button ng-click="toPage()">确定</button>
		<a href="javascript:" ng-click="nextPage()">后一页</a>
	</div>
	<dialog id="insert_promoter_dialog">
	<div class="form-row">
		<label class="form-label">账号</label> <input id="insert_username"
			class="form-input" placeholder="请填写">
	</div>
	<div class="form-row">
		<label class="form-label">密码</label> <input id="insert_password"
			type="password" class="form-input" placeholder="请填写">
	</div>
	<div class="form-row">
		<label class="form-label">姓名</label> <input id="insert_name"
			class="form-input" placeholder="请填写">
	</div>
	<div class="form-row">
		<label class="form-label">支付宝账户</label> <input
			id='insert_alipay_username' class="form-input" placeholder="请填写">
	</div>
	<div class="form-row">
		<label class="form-label">分成比例</label> <input id='insert_rate'
			value="0.4" class="form-input" placeholder="请填写">
	</div>
	<button ng-click="insertOk()">确定</button>
	<button ng-click="insertCancel()">关闭</button>
	</dialog>
	<dialog id="insert_district_dialog">
	<div class="form-row">
		<label class="form-label">城市</label> <input id="district_insert_city"
			class="form-input" placeholder="请填写">
	</div>
	<div class="form-row">
		<label class="form-label">区（县）</label> <input
			id="district_insert_district" class="form-input" placeholder="请填写">
	</div>
	<button ng-click="insertDistrict()">确定</button>
	<button
		onclick="document.getElementById('insert_district_dialog').close()">关闭</button>
	</dialog>
	<dialog id="district_list_dialog">
	<p>{{promoterName}}的代理区域列表</p>
	<button
		onclick="document.getElementById('insert_district_dialog').showModal()"
		class="pure-button blue">新建代理区域</button>
	<table class="horizontal-center pure-table pure-table-bordered">
		<thead>
			<tr>
				<th>市</th>
				<th>区（县）</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<tr ng-repeat="d in districtRelations">
				<td>{{d.city}}</td>
				<td>{{d.district}}</td>
				<td><button ng-click="deleteDistrict(d.id)">删除</button></td>
			</tr>
		</tbody>
	</table>
	<button
		onclick="document.getElementById('district_list_dialog').close()">关闭</button>
	</dialog>
</body>
<script type="text/javascript" src="js/promoter_list.min.js"></script>
</html>